package com.platform.boot.security.user;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.beans.BeanUtils;

/**
 * @author <a href="https://github.com/vnobo">Alex bob</a>
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class UserOnly extends User {

    public static UserOnly withUser(User user) {
        UserOnly userOnly = new UserOnly();
        BeanUtils.copyProperties(user, userOnly);
        return userOnly;
    }

    @Override
    @JsonIgnore
    public String getPassword() {
        return super.getPassword();
    }

    @Override
    @JsonIgnore
    public boolean isNew() {
        return super.isNew();
    }
}